package com.yanqu.road.server.cmd.monopolymarket.office;

import com.yanqu.road.pb.monopolymarket.MonopolyMarketProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.monopolymarket.MonopolyMarketOfficeMgr;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.Protocol;

/**
 * @Description
 * @Author cwq
 * @Data 2021/8/12 17:08
 */
@Cmd(code = Protocol.C_CROSS_MONOPOLY_MARKET_OFFICE_ENTER, desc = "进入大宋榷署 大厅")
public class CrossMonopolyMarketOfficeEnterCmd extends CrossCommand {

    private long userId;
    private int page;
    private long time;
    private boolean isGetNoctice;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        MonopolyMarketProto.MonopolyMarketEnterOfficeReqMsg req = MonopolyMarketProto.MonopolyMarketEnterOfficeReqMsg.parseFrom(packet.getBytes());
        userId = packet.getPlayerId();
        page = req.getPage();
        time = req.getTime();
        isGetNoctice = req.getIsGetNotice();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        MessageHelper.sendPacket(serverId, userId , YanQuMessageUtils.buildMessage(ClientProtocol.U_MONOPOLY_MARKET_OFFICE_ENTER, MonopolyMarketOfficeMgr.enterOffice(page, time, serverId,isGetNoctice)));
    }

    @Override
    public void sendData() {

    }
}
